package com.hsoft.zhxy.app.xtgl_02_01.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hsoft.zhxy.app.common.model.entity.YhglEntity;
import com.hsoft.zhxy.app.xtgl_02_01.model.query.YhglQuery;
import com.hsoft.zhxy.app.xtgl_02_01.model.vo.YhjcxxVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface YhglMapper extends BaseMapper<YhglEntity> {

    /**
     * 获取用户信息和部门信息
     * @param pageObj
     * @param yhglQuery
     * @return
     */

    @Select("<script> " +
            "   select  yh.yhid,\n" +
            "                yh.xm,\n" +
            "                yh.sjh,\n" +
            "                yh.dzyx,\n" +
            "                yh.sfms,\n" +
            "                yh.sfzj,\n" +
            "                yh.kdlfs,\n" +
            "                yh.yhzt,\n" +
            "                yh.sjlybz,\n" +
            "                yh.bz,\n" +
            "                yh.cjsj,\n" +
            "                yh.bgsj， " +
            "                bm.bmmc,\n" +
            "                bm.bmm\n" +
            "  from jcqx_yh yh\n" +
            "  left join jcqx_yhbm yhbm\n" +
            "    on yh.yhid = yhbm.yhid\n" +
            "  left join jcqx_bm bm\n" +
            "    on yhbm.bmm = bm.bmm\n" +
            " ${ew.customSqlSegment} " +
            "</script>")
    IPage<YhjcxxVO> listYhxxAndBmByYhid(Page<YhglQuery> pageObj, @Param("ew")  QueryWrapper<YhglQuery> queryWrapper);

}
